<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>找出数组中小于10 的数据</title>
</head>
<body>
    
</body>
<script>
    var arr = [10,15,2,32,5,4,20,8,48,54,6];

    function filter(item,val) {
        let newArr = [];
        for (let i = 0; i < item.length; i++) {
            if (item[i] < val) {
                newArr.push(item[i]);
            }
        }
        return newArr;
    }

    console.log(filter(arr, 10));
</script>
</html>